<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once(APPPATH.'controllers/Abstractfront.php');
class Data extends Abstractfront {

	public function  __construct()
    {
        parent::__construct();
        $this->load->model("pointmodel");
        $this->load->model("datamodel");
    }

	public function index()
	{
		$this->load->view('data.php');
	}

	public function fetchData() 
	{
		$phone_id = $this->input->post('id');
		$table = 'gm_data_'.$phone_id;

		$result = $this->datamodel->getAll($table);

		if ($result) {
			self::json(array('code' => '1', 'data' => $result));
		}
		else {
			self::json(array('code' => '0', 'msg' => '获取数据失败！'));
		}
	}
	
}
?>
